package com.cherkashyn.vitaliy.devices.ethernet.socket3.commands.manage;

import com.cherkashyn.vitaliy.devices.ethernet.socket3.commands.BaseCommand;

public class CommandOutput extends BaseCommand<Byte>{
    public static enum OUTPUT_PIN{
	FIRST((byte)0),
	SECOND((byte)1);
	
	private final byte value;
	OUTPUT_PIN(byte value){
	    this.value=value;
	}
    }
    
    protected static enum DIRECTION{
	ON((byte)1),
	OFF((byte)0);
	
	private final byte value;
	DIRECTION(byte value){
	    this.value=value;
	}
    }
    
    private final byte[] request;
    
    public CommandOutput(OUTPUT_PIN pin, DIRECTION direction){
	//                     command    portNumber       direction    permanent 
	this.request=new byte[]{  0x43, pin.value,   direction.value,          0};
    }
    
    @Override
    protected byte[] getRequestBytes() {
	return this.request;
    }

    @Override
    protected int getLengthOfResponse() {
	return 4;
    }

}
